#include <bits/stdc++.h>
using namespace std;
bool b[100000];
long long n,r[100000],i=1,s=1,mi;
int main(){
    freopen("duel.in","r",stdin);
    freopen("duel.out","w",stdout);
    cin>>n;
    long long a=n;
    for(i=0;i<n;i++)
        cin>>r[i];
    sort(r,r+n);
    i=1;
    while(i<n){
        while(r[i]==r[i-1]){
            s++,i++;
        }
        a-=s;
        for(i=n-a+1;i<n;i++){
            if(!b[i])
                b[i]=1,s--;
            if(s==0)break;
        }
        if(s){
            cout<<a+s-1;
            return 0;
        }
        s=1;
    }
    cout<<1;
    return 0;
}
